<template>
	<view class="content">
		<view class="tou" @tap="jumpsetup">
			<image class="touxiang" :src=avantar mode=""></image>
			<text>{{nickname}}</text>
			<image class="jiantou"  src="../../static/icon/zuojiantou.png" mode=""></image>
		</view>
		<view class="box1">
			<view class="row1">
				{{fil}} FIL
			</view>
			<view class="row2">钱包总资产</view>
			<view class="row3">
				<view class="minibtn" @tap="jumpchongzhi">
					去充值
				</view>
				<!-- <view class="you">
					<text>是否开启自动化划转</text>
					<switch :checked="open"  @change="switch2Change" />
				</view> -->
			</view>
		</view>
		<view class="box2" @tap="jumpjiqun">
			<image class="tubiao" src="../../static/icon/jiqun.png" mode=""></image>
			<text>我的集群</text>
			<image class="jiantou" src="../../static/icon/zuojiantou.png" mode=""></image>
		</view>
		<!-- <view class="box2" @tap="jumpyaoqing">
			<image class="tubiao" src="../../static/icon/yaoqinghaoyou.png" mode=""></image>
			<text>邀请好友</text>
			<image class="jiantou" src="../../static/icon/zuojiantou.png" mode=""></image>
		</view> -->
		<view class="box2" @tap="jumpzhanghuguanli">
			<image class="tubiao" src="../../static/icon/anquanshezhi.png" mode=""></image>
			<text>安全设置</text>
			<image class="jiantou" src="../../static/icon/zuojiantou.png" mode=""></image>
		</view>
		<view class="box2" @tap="jumpNotice">
			<image class="tubiao" src="../../static/icon/lingdan.png" mode=""></image>
			<text>公告</text>
			<image class="jiantou" src="../../static/icon/zuojiantou.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				open:false,
				avantar:'',
				nickname:'',
				fil:'',
				
			}
		},
		onLoad() {
			this.getinfo()
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			getinfo(){
				var token =uni.getStorageSync('token')
				if(token==''||token==null){
					uni.reLaunch({
					    url:'../../login/login'
					})
				}else{
					this.http({
					 	url:'/api/Page/my',
					 	method:'POST',
						header:{
							'token':token
						},
					 	success:(res)=>{
							console.log(res)
							this.avantar = res.data.avantar
							this.nickname =res.data.nickname
							this.fil = res.data.fil
						},
					 	error:()=>{
					 		uni.showToast({
					 			title:"请求异常"	
					 		})
					 	},
						complete:(res)=>{
							console.log(res.code)
							if(res.code==1201){
								uni.removeStorage({
									key:'token'
								})
								uni.reLaunch({
									url:'../login/login'
								})
							}
						}
					 })
				} 
			},
			jumpsetup(){
				uni.navigateTo({
					url:'./setup/setup'
				})
			},
			jumpNotice(){
				uni.navigateTo({
					url:'../notice/notice'
				})
			},
			jumpchongzhi(){
				uni.navigateTo({
					url:'../qianbao/chongzhi/chongzhi'
				})
			},
			jumpyaoqing(){
				uni.showToast({
					title:'暂未开放',
					icon:'none'
				})
			},
			jumpjiqun(){
				uni.navigateTo({
					url:'./jiqun/jiqun'
				})
			},
			jumpzhanghuguanli(){
				uni.navigateTo({
					url:'./zhanghuguanli/zhanghuguanli'
				})
			},
			  switch2Change: function (e) {
			            console.log('switch2 发生 change 事件，携带值为', e.target.value)
			        }
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-family: PingFang SC;
		font-weight: 500;
		color:#2b2b2b;
		padding-bottom: 50rpx;
		.jiantou{
			width: 50rpx;
			height: 50rpx;
		}
		.tou{
			width: 588rpx;
			margin: 50rpx auto;
			display: flex;
			align-items: center;
			.touxiang{
				width: 130rpx;
				height: 130rpx;
				background: #2B2B2B;
				border-radius: 50%;
			}
			text{
				margin-left: 41rpx;
				font-size: 36rpx;
				font-weight: bold;
				flex: 1;
			}
		
		}
		.box1{
			width: 600rpx;
			height: 200rpx;
			background: #FFFFFF;
			box-shadow: 0px 0px 3px 0px rgba(43, 43, 43, 0.18);
			border-radius: 15rpx;
			margin: 0 auto 50rpx auto;
			.row1{
				text-align: center;
				margin: 10rpx auto 12rpx auto;
				font-size: 30rpx;
				font-weight: bold;
				color: #0072FF;
			}
			.row2{
				text-align: center;
				margin: 0 auto 20rpx auto;
				font-size: 30rpx;
				font-weight: bold;
			}
			.row3{
				width: 540rpx;
				margin: 0 auto;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.minibtn{
					width: 126rpx;
					height: 60rpx;
					background: #0072FF;
					border-radius: 30rpx;
					font-size: 30rpx;
					font-weight: bold;
					text-align: center;
					color: #FFFFFF;
					line-height: 60rpx;
				}
				text{
					font-size: 24rpx;
				}
			}
		}
		.box2{
			width: 640rpx;
			height: 98rpx;
			background: #FFFFFF;
			box-shadow: 0px 0px 3px 0px rgba(43, 43, 43, 0.18);
			border-radius: 10rpx;
			margin: 0 auto 40rpx auto;
			display: flex;
			align-items: center;
			padding: 0 15rpx 0 35rpx;
			.tubiao{
				width: 48rpx;
				height: 48rpx;
			}
			text{
				flex: 1;
				margin-left: 31rpx;
				font-size: 28rpx;
				font-weight: bold;
			}
		}
	}

	
</style>
